/* eslint valid-jsdoc: "off" */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
	/**
	 * built-in config
	 * @type {Egg.EggAppConfig}
	 **/
	const config = exports = {};

	// use for cookie sign key, should change to your own and keep security
	config.keys = appInfo.name + '_1709705444205_4203';

	// add your middleware config here
	config.middleware = [];
	config.sequelize = {
		dialect: "postgres",
		host: "pgm-bp1j4g0l6dxy3161vo.pg.rds.aliyuncs.com",
		database: "n_cst",
		port: 5432,
		username: "postgres",
		password: "123ABCabc",
		timezone: "+08:00",
		define: {
			timestamps: true, // 自动生成时间戳
			paranoid: true, // 软删除
			createdAt: "created_at",
			updatedAt: "updated_at",
			deletedAt: "deleted_at",
			freezeTableName: true, // 表名不加suffix
			charset: "utf8mb4",
			collate: "utf8mb4_unicode_ci",
			dialectOptions: {
				useUTC: false, // for reading from database
			}
		},
	}
	config.weapp = {
		appid: 'wx1c05a2284e296e05',
		appsecret: "1dbc97c15b21a4a13f85929feaf6948c",
		token: "weixin",
		// 支付配置 v2
		mch_id: "1649951553",
		secretV2: "CQWKXYhKauMyg0ofab9kDNPb9BMTII7G",
		notify_url: "/api/order/wxnotify",
		merchantPrivateKeyFilePath: "/path/to/merchant/apiclient_key.pem",
		// 公众号配置
		we_appid: "wxb7b72523fcef8bd9",
		we_appsecret: "a432205492efa6059d2e728015d7cf2b"
	}
	config.jwt = {
		secret: "qst1888",
		expiresIn: "2h" // token过期时间 单位秒，默认3天
	}
	config.proxy = true;
	config.security = {
		csrf: {
			enable: false,
		},
		domainWhiteList: ["*"], // 白名单
	}
	config.cors = {
		origin: "*", // 跨任何域
		allowMethods: "GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS", // 被允许的请求方式
		credentials: true // 支持cookie跨域
	};
	config.multipart = {
		mode: 'file',
	}

	config.sms = {
		accessKeyId: "LTAI5t8atrd6Tv5MUa9amGYd",
		accessKeySecret: "frxCsuJFlivy4kGBaeFHXzGI1kFIWK",
		signName: "企穗通",
		templateCode: "SMS_283030200",
	}

	// add your user config here
	const userConfig = {
		// myAppName: 'egg',
	};

	return {
		...config,
		...userConfig,
	};
};
